﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrafficLightSim
{
    public enum LightState { Red, Yellow, Green };
    public class TrafficLight
    {
        LightState state; //red green or yellow?
        Direction directionControl;

        public Direction DirectionControl
        {
            get { return directionControl; }
            set { directionControl = value; }
        }

        public LightState State
        {
            get { return state; }
            set { state = value; }
        }

        #region constructor region

        public TrafficLight()
        {
            state = LightState.Green;
        }

        public TrafficLight(LightState state)
        {
            this.state = state;
        }

        #endregion

        #region Method Region

        public void ChangeState()
        {
            if (state == LightState.Red)
            {
                state = LightState.Green;
            }
            else if (state == LightState.Green)
            {
                state = LightState.Yellow;
            }
            else if (state == LightState.Yellow)
            {
                state = LightState.Red;
            }
        }

        #endregion
    }
}
